<?php
//留言模式选择
namespace app\admin\controller;

use \think\Controller;
use think\Db;
use app\admin\controller\Permissions;
// use app\admin\model\Messages;
class MessageType extends Permissions
{
    //
    public function index()
    {
		
		//是新增操作
		if($this->request->isPost()) {
			//是提交操作
			$post = $this->request->post();
            if(false == Db::name("message_type")->where('id',1)->update($post)) {
            	return $this->error('提交失败');
            } else {
                // addlog($model->id);//写入日志
            	return $this->success('提交成功','admin/message_type/index');
            }
		} else {
			$type=Db::name("message_type")->where("id",1)->find();
            // var_dump($type);
            $this->assign("type",$type);
			return $this->fetch();
		}
    }
    
}
